package com.dq.order.client.fallback;

import com.dq.commonutils.dto.OrderCourseVo;
import com.dq.order.client.CourseClient;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @project: guli_parent
 * @ClassName: CourseClientFallBack
 * @author: dq
 * @creat: 2022/8/17 17:08
 */
@Component
@Slf4j
public class CourseClientFallBackFactory implements FallbackFactory<CourseClient> {
    @Override
    public CourseClient create(Throwable throwable) {

        return new CourseClient() {
            @Override
            public OrderCourseVo getOrderCourseInfo(String courseId) {
                log.error("--------------------");
                log.error("开启了CourseClient的熔断降级功能 ");
                log.error("--------------------");
                return null;
            }
        };
    }
}
